/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 *
 * $Rev: 19 $
 * $LastChangedDate: 2009-04-14 16:14:44 +0000 (Tue, 14 Apr 2009) $
 */

package Main;

import java.util.*;


/**
 *
 * @author moreto
 */
public class IntervalTimer extends TimerTask {
    //MainMIDlet midlet;
    private ResultCanvas canvas;
    private long timeMilliseconds;
    private long intervalMilliseconds;
    private long timeCounter = 0;

    public IntervalTimer (long t, long i){
        timeMilliseconds = t;
        intervalMilliseconds = i;
    }

    public void setCanvas(ResultCanvas c){
        canvas = c;
    }

    public void run(){
        canvas.setDate(timeMilliseconds + timeCounter);
        timeCounter = timeCounter + intervalMilliseconds;
        canvas.updateCanvas();
    }

}
